<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="css/estilo.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Cerrar Mesa</title>

<script type="text/javascript" language="JavaScript">

function valideDatos() {
	var numero = document.getElementById("numero");
	
	if((numero.value == "" || numero.value == '' || numero.value == null)
			|| numero.value==" ") {
		alert("Ingrese el Nro de mesa a cerrar");
		return false;
	
	} else  {
		return true;
	}
}

function justNumbers(e)
{
var keynum = window.event ? window.event.keyCode : e.which;
if ((keynum == 8) || (keynum == 46))
return true;
 
return /\d/.test(String.fromCharCode(keynum));
}
</script>
</head>
<body>

<h1>CERRAR MESA</h1>

<form action="CerrarMesaServlet" method="POST" onsubmit="return valideDatos();">

<table align="center">



<tr>
<td align="right">Numero de Mesa : </td>
<td><input type="text" name="numero" id="numero" onkeypress="return justNumbers(event);"></td>
</tr>


<tr>
<td><input type="button" value="Cancelar" style="font-size: 14px" onclick="window.location.href='index.jsp'"> </td>
<td><input type="submit" value="Cerrar"></td>
</tr>

<%

String msj = (String) request.getAttribute("mensajee");
if(msj=="error"){
	%>
	
<script type="text/javascript">alert('no hay una venta abierta para la mesa ingresada');</script>
<%} %>
<%
if(msj=="ok"){
	%>
	
<script type="text/javascript">alert('La mesa se ha cerrado correctamente');
window.location="index.jsp"
</script>

<%} %>


</body>
</html>